# -*- coding: utf-8 -*-
# @Time    : 2021/10/20 14:38
# @Author  : TangDagui
# @Email   : 3297364807@qq.com
# @File    : __init__.py.py
# @Software: PyCharm
import pymssql


def conn():
    connect = pymssql.connect('(local)', 'sa', 'admin', 'luolin')  # 服务器名,账户,密码,数据库名
    if connect:
        print("连接成功!")
    return connect


if __name__ == '__main__':
    conn = conn()
    cur = conn.cursor()
    cur.execute("Select * from Student")
    data = cur.fetchall()
    for i in data:
        print(i)
